home *** CD-ROM | disk | FTP | other *** search
/ Turnbull China Bikeride / Turnbull China Bikeride - Disc 1.iso / CYBERVILLAGE / ANT / ANTUTILS.ZIP / !GetmyMail / !RunImage (.txt) < prev    next >
RISC OS BBC BASIC V Source  |  1998-12-17  |  7KB  |  303 lines

  1.  Getmyymail by Stuart Halliday 
  2.  1998
  3.  V1.00
  4. errorbox(
  5. ,"Error at "+
  6. $+" "+
  7.  "OS_GetEnv" 
  8.  command%
  9. &command$=
  10. getlowerstring(command%)
  11. 9command$=
  12. command$,
  13. (command$)-
  14. command$,""" ")-1)+
  15. mail%=3
  16. command$,"m") 
  17.  mail%=1
  18. command$,"n") 
  19.  mail%=2
  20.  q% &4000,buffer% 256,iconnames$(50),titlename$(255),win%(255)
  21. initwimp("GetMyMail")
  22. ("Set getmymail$loaded yes")
  23. findicon("on line") =
  24.  online%=
  25.  online%=
  26.  "OS_GSTrans","<getmymail%timelimit>",buffer%,256
  27. *timelimit%=
  28. getlowerstring(buffer%))
  29.  timelimit%<2 
  30.  timelimit%=1
  31. closedown%=
  32.  wait up to 1 min for ANT Suite to load completely
  33. findicon("internet") =
  34.   t%=
  35.   found%=
  36. "5   
  37. >t%+100 
  38.  found%=
  39. findicon("internet"):t%=
  40.  >T%+(1*6000) 
  41.  found%=
  42.  OK, InetSuite is now loaded, but force a wait of 2sec
  43.   t%=200
  44. :fin%=
  45.  >T%+t% 
  46. sendmailmessage(3)
  47. sendmailmessage(1)
  48.     fin%=
  49.  fin%=
  50.  recheck every 10secs to see if INETSUITE has finished transfering
  51.  BUT if more than timelimit% in mins have passed then switch off anyway!
  52. found%=
  53.  >T%+(timelimit%*6000) 
  54.  suitefinished%=
  55.  online% = 
  56. no_transfers_are_in_progress=
  57.  disconnect / go offline
  58.  &4AF53, 0, 0, "Remote"
  59.  &4AF53, 2, 0, "Remote"
  60.  reset Modem
  61. "OS_SerialOp",2,200
  62. "OS_SerialOp",3,"A"
  63. "OS_SerialOp",3,"T"
  64. "OS_SerialOp",3,"Z"
  65. "OS_SerialOp",3,
  66. closedown
  67. sendmailmessage(type%)
  68.  type% 
  69.  mail%=1, 1 
  70.  mail%=3:
  71.  email transfer 
  72.     buffer%!0=32
  73.     buffer%!12=0
  74.     buffer%!16=&46005
  75.     buffer%!20=1 
  76. Z*    
  77.  "Wimp_SendMessage",17,buffer%,0
  78.  mail%=1, 1 
  79.  mail%=3:
  80.  email send only 
  81.     buffer%!0=32
  82.     buffer%!12=0
  83.     buffer%!16=&46005
  84.     buffer%!20=2 
  85. c*    
  86.  "Wimp_SendMessage",17,buffer%,0
  87.  mail%>1:
  88.  News transfer
  89.     buffer%!0=32
  90.     buffer%!12=0
  91.     buffer%!16=&46005
  92.     buffer%!20=3 
  93. k*    
  94.  "Wimp_SendMessage",17,buffer%,0
  95.  mail%>1:
  96.  News send only
  97.     buffer%!0=32
  98.     buffer%!12=0
  99.     buffer%!16=&46005
  100.     buffer%!20=4
  101. s*    
  102.  "Wimp_SendMessage",17,buffer%,0
  103.  "Wimp_Poll",0,q% 
  104.  reason%
  105.  reason% 
  106.  17,18,19 :
  107. message
  108.  closedown%=
  109. closedown
  110. closedown
  111. ("UNSET getmymail$loaded")
  112.  "XWimp_CloseDown"
  113. message
  114.  q%!16 
  115.  0 :closedown%=
  116.  &400C7 :taskname$=
  117. getlowerstring(q%+28)
  118.  &46006 :  
  119.  (q%!20) = 1 
  120.  suitefinished%=
  121. initwimp(taskname$)
  122.  "Wimp_Initialise",200,&4B534154,taskname$ 
  123.  ,taskhandle%
  124. closedown%=
  125. suitefinished%=
  126. findicon(iconwanted$)
  127. win%=-2:found%=
  128. iconwanted$,1)) =0 
  129. get_names_of_icons(win%)
  130.  loop%=0 
  131.  nooficons%
  132.  iconnames$(loop%)=iconwanted$ 
  133.    found%=
  134.    loop%=nooficons%
  135. =found%
  136. get_names_of_icons(windowread%)
  137. !q%=windowread%
  138.  "Wimp_GetWindowInfo",,q%
  139.  ic%=0
  140.  !q%=20:q%!12=0:q%!16=0
  141.  "XWimp_SendMessage",19,q%,windowread%,ic% 
  142.  ,,task%
  143. nooficons%=(q%!88)-1
  144.  ic%=0 
  145.  nooficons%
  146.  windowread%=-2 
  147.     !q%=20:q%!12=0:q%!16=0
  148. >    
  149.  "XWimp_SendMessage",19,q%,windowread%,ic% 
  150.  ,,task%
  151. 5 iconnames$(ic%)=
  152. iconname(task%,windowread%,ic%)
  153.  OSCLI("SET icon"+STR$ic%+" "+iconname$)
  154. iconname(task%,window%,icon%)
  155. valid$=""
  156.  icon% 
  157.  -1 :iconname$="Background, no icon present"
  158.  -2 :iconname$="Back Icon"
  159.  -3 :iconname$="Close Icon"
  160.  -4 :iconname$="Title Bar"
  161.  -5 :iconname$="Toggle Icon"
  162.  -6 :iconname$="Scroll Up"
  163.  -7 :iconname$="Vertical Bar"
  164.  -8 :iconname$="Scroll Down"
  165.  -9 :iconname$="Adjust Size"
  166.  -10 :iconname$="ScrollRight"
  167.  -11 :iconname$="Horizontal Bar"
  168.  -12 :iconname$="Scroll Left"
  169.    !q%=window%
  170.    q%!4=icon%
  171.  "Wimp_GetIconState",,q%
  172.    iconname$=""
  173.  ((q%!24) 
  174.  256)=0 
  175. (    iconname$=
  176. getlowerstring(q%+28)
  177.  task%=0 
  178.      iconname$="Unknown"
  179.         
  180.      
  181.  ((q%!24) 
  182.  1)=0 
  183. .      iconname$=
  184. getremstring(task%,q%!28)
  185.      
  186.       
  187.  (q%!32)=-1 
  188.       valid$=""
  189.       
  190. +      valid$=
  191. getremstring(task%,q%!32)
  192. '     iflag%=((q%!24) 
  193.  &F000) >> 12
  194.       
  195. .      iconname$=
  196. getremstring(task%,q%!28)
  197. >      
  198.  iconname$="" 
  199.  iconname$=
  200. valid$,2,
  201. valid$,",")-2)
  202.      
  203.         
  204. =iconname$
  205. getremstring(task%,ptr%)
  206. $buffer%="<Unknown>"
  207.  "XWimp_TransferBlock",task%,ptr%,taskhandle%,buffer%,256
  208.  ptr%=buffer%
  209. getlowerstring(buffer%)
  210. getlowerstring(ptr%)
  211.  p$=""
  212.  (?ptr%>31 
  213.  ?ptr%<256) 
  214. (p$)<255
  215.  ?ptr%>=65 
  216.  ?ptr%<=90 
  217.  p$+=
  218. ((?ptr%)+32) 
  219.  p$+=
  220. ?ptr%
  221.   ptr%+=1
  222. getlist
  223.  winnumber%=0
  224.  win%(winnumber%)=bottom%
  225.  winnumber%+=1
  226. 3   win%(winnumber%)=
  227. nextup(win%(winnumber%-1))
  228.    winnumber%+=1
  229.  win%(winnumber%-1) = -1
  230.  winnumber%-=1
  231.  winnumber%>100 
  232.  winnumber%=100
  233.  winnumber%<0 
  234.  winnumber%=0
  235.  win%(winnumber%)=-2
  236.  loop%= 0 
  237.  winnumber%
  238.   win%=win%(loop%)
  239. -  titlename$(loop%)=
  240. get_title_name(win%)
  241.   OSCLI("Set winwatch"+STR$ loop%+" "+titlename$(loop%))
  242. get_title_name(gwindow%)
  243.  no_of_icons%
  244. !q%=gwindow%
  245.  "XWimp_GetWindowInfo",,q%
  246.    no_of_icons%=q%!88
  247.    waminx%=q%!44
  248.    waminy%=q%!48
  249.    wamaxx%=q%!52
  250.    wamaxy%=q%!56
  251.    h%=wamaxy%-waminy%
  252.    w%=wamaxx%-waminx%
  253.  ((q%!60) 
  254.  256)=0 
  255. *    windowname$=
  256. getlowerstring(q%+76)
  257. 7    
  258.  windowname$="<Untitled>" 
  259.  windowname$="None"
  260.     val%=?(q%+76)
  261.     icon%=-1
  262.     !q%=20:q%!12=0:q%!16=0
  263. =    
  264.  "XWimp_SendMessage",19,q%,gwindow%,icon% 
  265.  ,,task%
  266. /     windowname$=
  267. getremstring(task%,q%!76)
  268.  windowname$="" 
  269. <    windowname$="#w"+
  270.  w%+ " h"+
  271.  h%+" n"+
  272.  no_of_icons%
  273.  gwindow%=-2 
  274.  windowname$="icon bar"
  275. =windowname$
  276. getbottom
  277.  !buffer%=-2
  278.  "XWimp_GetWindowState",,buffer%
  279.  bottom%=buffer%!28
  280. =bottom%
  281. nextup(window%)
  282. !buffer%=window%
  283.  "XWimp_GetWindowState",,buffer%
  284. =buffer%!28
  285. no_transfers_are_in_progress
  286. &  w$="document being fetched"
  287.  flag%=
  288.  bottom%=
  289. getbottom
  290. getlist
  291.  w%=winnumber% 
  292.  "Wimp_Poll",0,q%
  293.  w$=titlename$(w%) 
  294.    flag%=win%(w%):w%=0
  295. =flag%
  296. errorbox(error%,error$,flags%)
  297. 5( !buffer%=error%:$(buffer%+4)=error$
  298.  "Wimp_ReportError",buffer%,flags%,taskname$ 
  299.  ,result%
  300.  result%=2 
  301.  "Wimp_CloseDown":
  302.  "OS_Exit"
  303.